<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<meta
			http-equiv="X-UA-Compatible"
			content="IE=edge"
		>
		<meta
			name="viewport"
			content="width=device-width, initial-scale=1.0"
		>
		<title>Document</title>
	</head>

	<body>
<script>
	 const p=new Promise((res,rej)={
		 $.ajax({
			 type: "GET",
			 url: "test.json",
			 dataType: "json",
			 success: function (data) {
				 let { id } = data
				 res(id)
				},
			error:function(error){
				rej(error)
			}
	 })})
	const a= p.then(res=>{
		$.ajax({
			 type: "GET",
			 url: "test.json",
			 dataType: "json",
			 data: { id: res },
			 success: function (data) {
				 let { useName } = data
				return useName
			 },
			 error: function (error) {
				throw new  error("出错了")
			 }
		 })
	 })
	 a.then(res=>{
		 $.ajax({
			 type: "GET",
			 url: "test.json",
			 dataType: "json",
			 data: { useName: res },
			 success: function (data) {
				 let { msg } = data
				console.log("已经获取用户信息");
			 },
			 error: function (error) {
				 throw new error("出错了")
			 }
		 })
	 })
</script>
	</body>

</html>
